#ifndef __UTILS_LOG_H__
#define __UTILS_LOG_H__
#include <time.h>
#include <sys/time.h>

int ReadLogFromFile(char *jsonLog, int logLen);
int WriteLogToFile(const char *logStr);

#define LOG_TO_FILE(fmt,...) do {\
    char logBuf[128]={0};\
    struct timeval tvNow;\
    gettimeofday(&tvNow, NULL);\
    int64_t timeMs = (int64_t)(tvNow.tv_sec)*1000 + (int64_t)(tvNow.tv_usec)/1000;\
    snprintf(logBuf, sizeof(logBuf), "[%lld]-[%s-%d]:"fmt, timeMs, __func__, __LINE__, ##__VA_ARGS__);\
    WriteLogToFile(logBuf);\
}while (0)


#endif